﻿using System;
using System.Data;
using System.Data.SqlClient;

namespace DataAccess
{
    public class DaMain
    {
        public DataTable selReportedTime(DateTime date,string email, string companyid)
        {
            string strCommandText = "selReportedTime"+ companyid;
            SqlParameter[] paraLocal = new SqlParameter[2];
            paraLocal[0] = new SqlParameter("@Date", date);
            paraLocal[1] = new SqlParameter("@Email", email);
            return SqlHelper.ExecuteData(CommandType.StoredProcedure, strCommandText, paraLocal);
        }

        public DataTable selReportedTimeActivity(DateTime date, string email, string companyid)
        {
            string strCommandText = "selReportedTimeActivity" + companyid;
            SqlParameter[] paraLocal = new SqlParameter[2];
            paraLocal[0] = new SqlParameter("@Date", date);
            paraLocal[1] = new SqlParameter("@Email", email);
            return SqlHelper.ExecuteData(CommandType.StoredProcedure, strCommandText, paraLocal);
        }

        public DataTable selMyProject(string email, string companyid)
        {
            string strCommandText = "selMyProject" + companyid;
            SqlParameter[] paraLocal = new SqlParameter[1];
            paraLocal[0] = new SqlParameter("@Email", email);
            return SqlHelper.ExecuteData(CommandType.StoredProcedure, strCommandText, paraLocal);
        }

        public DataTable selWeekend(DateTime date, string email, string companyid)
        {
            string strCommandText = "selWeekend" + companyid;
            SqlParameter[] paraLocal = new SqlParameter[2];
            paraLocal[0] = new SqlParameter("@Date", date);
            paraLocal[1] = new SqlParameter("@Email", email);
            return SqlHelper.ExecuteData(CommandType.StoredProcedure, strCommandText, paraLocal);
        }

        public bool createDatabase(string url,string companyid)
        {
            return SqlHelper.ExecuteSqlScript(url,companyid);
        }
    }
}
